//
//  PullDownButton.m
//  BigToBig
//
//  Created by liuyi on 7/21/16.
//  Copyright © 2016 cn.cloudtp. All rights reserved.
//

#import "PullDownButton.h"

@implementation PullDownButton

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
+ (PullDownButton *)createButtonWithTitle:(NSString *)title frame:(CGRect)frame tag:(NSInteger)tag{
    PullDownButton *button = [[PullDownButton alloc]initWithFrame:frame];
    [button setTitle:title forState:UIControlStateNormal];
    //    [button addSubview:[self buttonImageViewWithTitle:title]];
    
    [button.titleLabel setFont:[UIFont systemFontOfSize:(frame.size.width / 6 * 5)/ 6]];
    [button setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    [button setTitleColor:COLOR_RGBA(88, 165, 255, 1.0) forState:UIControlStateSelected];
    button.tag = tag;
    
    button.downImageView = [[UIImageView alloc]initWithFrame:CGRectMake(frame.origin.x + frame.size.width / 6 * 5, 0, frame.size.height / 2 + 2, frame.size.height / 5 * 2 + 3)];
    button.downImageView.center = CGPointMake(frame.size.width - frame.size.height / 4, frame.size.height / 2);
    button.downImageView.image = [UIImage imageNamed:@"xl-button"];
    [button addSubview:button.downImageView];
    
    return button;
    
}

@end
